package com.shujia.day08.ketang;

/*
    假如我们在开发一个系统时需要对员工类进行设计，员工包含3个属性：姓名、工号以及工资。
    经理也是员工，除了含有员工的属性外，另为还有一个奖金属性。
    请使用继承的思想设计出员工类和经理类。要求类中提供必要的方法进行属性访问。
 */


abstract class Staff{
    String name;
    String id;
    int salary;

    public Staff() {
    }

    public Staff(String name, String id, int salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

    public abstract void work();
}

class Worker extends Staff{

    public Worker() {
    }

    public Worker(String name, String id, int salary) {
        super(name, id, salary);
    }

    @Override
    public void work() {
        System.out.println("普通员工敲代码");
    }
}

class Manager extends Staff{

    int common;

    public Manager() {
    }

    public Manager(String name, String id, int salary, int common) {
        super(name, id, salary);
        this.common = common;
    }

    @Override
    public void work() {
        System.out.println("经理做PPT");
    }
}

public class AbstractTest {
    public static void main(String[] args) {
        Staff s1 = new Worker("李刚", "sj1001", 10000); // 抽象多态
        s1.work();

        Staff s2 = new Manager("江川","sj1002",6000,200000);
        s2.work();
    }
}
